<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <title>Blog后台</title>
    <link rel="stylesheet" th:href="@{/css/bootstrap.css}">
    <script th:src="@{/js/jquery.js}"></script>
    <script th:src="@{/js/bootstrap.js}"></script>
</head>
<body style="background-color:#eee;">

<div th:replace="~{commons/admin/topbar::top-bar}"></div>


<div class="row">
    <!--    引入共有侧边栏-->
    <div th:replace="~{commons/admin/leftbar::left-bar}"></div>


    <div class="col-xs-12 col-sm-9 col-md-10 pull-right" style="background-color:#FFFFFF;">
        <div class="row bg-info text-center">
            <h4>个人信息</h4>
        </div><br>


        <div class="container-fluid" style="min-height: 800px;">
            <div class="row">

                <form id="info" method="post" th:action="@{/admin/adminUserUpdateInfo}" enctype="multipart/form-data">
                    <h4>带&nbsp;<b><span class="text-danger">*</span></b>&nbsp;号的为必填项</h4>
                    <div class="form-group">
                        <label>用户名：&nbsp;<b><span class="text-danger">*</span></b></label>
                        <input type="text" class="form-control" name="username" th:value="${adminUser.username}">
                    </div>

                    <div class="form-group">
                        <label>真实姓名：&nbsp;<b><span class="text-danger">*</span></b></label>
                        <input type="text" class="form-control" name="trueName" th:value="${adminUser.trueName}">
                    </div>

                    <div class="form-group">
                        <label>性别：&nbsp;<b><span class="text-danger">*</span></b></label>
                        <select class="form-control" name="gender">
                            <option value="1" th:if="${adminUser.gender}==1" th:selected="selected">男</option>
                            <option value="0" th:if="${adminUser.gender}==0" th:selected="selected">女</option>

                            <option value="1" th:if="${adminUser.gender}==0">男</option>
                            <option value="0" th:if="${adminUser.gender}==1">女</option>
                        </select>
                    </div>

                    <div class="form-group">
                        <label>QQ：&nbsp;<b><span class="text-danger">*</span></b></label>
                        <input type="text" class="form-control" name="qq" th:value="${adminUser.qq}">
                    </div>

                    <div class="form-group">
                        <label>wechat：&nbsp;<b><span class="text-danger">*</span></b></label>
                        <input type="text" class="form-control" name="wechat" th:value="${adminUser.wechat}">
                    </div>

                    <div class="form-group">
                        <label>个性签名：</label>
                        <textarea class="form-control" name="signature" rows="3">[[${adminUser.personalBrief}]]</textarea>
                    </div>

                    <div class="form-group">
                        <label>头像：</label>
                        <img th:src="@{/imgs/header.png}" class="img-thumbnail" id="avatarImg" width="140">
                        <input type="file" id="paperPath" name="filename"/>
                        <span id="te2" style="color: red">上传大小不能超过5M*上传文件类型必须为：jpg png</span>
                    </div>

                    <div class="text-center">
                        <button type="submit" class="btn btn-default">保存</button>
                    </div>
                </form>
            </div>
        </div><br>

        <div class="pull-right"><a href="" target="_blank">Power By Wangzz</a>&nbsp;&nbsp;</div>
    </div>


</div>
</body>
<script>
    //文件上传的检测
    $("#info").submit(function() {
        var paperPath=$("#paperPath").val();//获取文件
        var point = paperPath.lastIndexOf(".");
        var type = paperPath.substr(point);//获取后缀
        var fileSzie=$("#paperPath")[0].files[0].size;//获取文件大小,得到的值为字节类型
        var judge=true;
        if(type.valueOf()!=".jpg" && type.valueOf()!=".png"){
            $("#te2").html("上传文件格式不正确");
            judge=false;
            if(fileSzie>5000000){
                $("#te2").html("上传文件过大");
                judge=false;
            }
        }else{
            $("#te2").html("")
        }
        return judge;
    });
</script>
</html>